package cn.edu.zafu.bigdata.Wym;

public class Wym_divide {

    public static void main(String[] args){
        try{
            int result= divide(10,0);//这里可更改被除数与除数；
            System.out.println("结果是："+result);
        }catch (ArithmeticException e) {
            System.out.println("错误,"+e.getMessage());
        }
    }

    public static int divide(int a, int b){
        if(b==0){
            throw new ArithmeticException("除数不能为0");//throw关键字用于显示地抛出一个异常；
        }
        return a/b;
    }

}
